-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[two_dimensional_scrollables] Merged cells for TableView #5917
Conversation
packages/two_dimensional_scrollables/lib/src/table_view/table.dart
Outdated
Show resolved
Hide resolved
7cb9e1a
to
b8fbc86
Compare
Design doc for flutter/packages#5917
_Description of what this PR is changing or adding, and why:_ Design doc for flutter/packages#5917 _Issues fixed by this PR (if any):_ Related to flutter/flutter#131224 ## Presubmit checklist - [x] This PR doesn’t contain automatically generated corrections (Grammarly or similar). - [x] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style) — for example, it doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person). - [x] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great test coverage!
packages/two_dimensional_scrollables/lib/src/table_view/table_cell.dart
Outdated
Show resolved
Hide resolved
packages/two_dimensional_scrollables/lib/src/table_view/table_delegate.dart
Outdated
Show resolved
Hide resolved
packages/two_dimensional_scrollables/lib/src/table_view/table_delegate.dart
Outdated
Show resolved
Hide resolved
packages/two_dimensional_scrollables/lib/src/table_view/table_delegate.dart
Outdated
Show resolved
Hide resolved
packages/two_dimensional_scrollables/lib/src/table_view/table.dart
Outdated
Show resolved
Hide resolved
packages/two_dimensional_scrollables/test/table_view/table_cell_test.dart
Outdated
Show resolved
Hide resolved
packages/two_dimensional_scrollables/test/table_view/table_cell_test.dart
Show resolved
Hide resolved
packages/two_dimensional_scrollables/test/table_view/table_cell_test.dart
Outdated
Show resolved
Hide resolved
packages/two_dimensional_scrollables/test/table_view/table_cell_test.dart
Outdated
Show resolved
Hide resolved
packages/two_dimensional_scrollables/test/table_view/table_delegate_test.dart
Outdated
Show resolved
Hide resolved
…cell.dart Co-authored-by: Michael Goderbauer <[email protected]>
Somehow the checks are rather unhappy now. |
ChildVicinity vicinity, { | ||
bool allowMerged = true, | ||
}) { | ||
return super.getChildFor(vicinity) ?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to change this to the suggestion in that other comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't because I want to be able to assert that if we requested a child that returned null (using the super getChildFor first), then it is for certain covered by a merged cell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, maybe stated better, I want to see if there is a canonical child first, and if not, need to ensure we have not lost a child so it asserts the vicinity returning null is in fact covered by a merged cell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. That makes sense. Thanks for the explanation!
Oh I see I accidentally committed some changes to the example app. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/// [TableVicinity] in a [TableView], but may return null. | ||
/// | ||
/// Used by [TableCellBuilderDelegate.builder] to build cells on demand for the | ||
/// table. | ||
typedef TableViewCellBuilder = Widget? Function( | ||
typedef TableViewCellBuilder = TableViewCell Function( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice this before: Is this intentional that null
is no longer allowed as a return value? If so, the doc above needs updating. (Remind me: what did it mean when this was previously returning null? What are we no longer allowing?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This felt like a bug I came across. Typically in Flutter scrolling land, returning null from the child delegate means we have reached the end of the children. This is not currently supported, but is part of supporting infinite children in the table: flutter/flutter#131226.
I think it was here by mistake since if you return null currently, with or without this change, it will crash! :(
/// represented by its [TableVicinity]. The table supports lazy rendering and | ||
/// will only instantiate those cells that are currently visible in the table's | ||
/// viewport and those that extend into the [cacheExtent]. | ||
/// Each child [TableViewCell] can belong to exactly one row and one column as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
über-nit: What do you think about inserting an "either" in this sentence between "to" and "exactly"? The first part of the sentence makes it sound like we don't support merged cells at all and then the second part catches you by surprise. With that either we can maybe emphasize a little more that the "exactly one row/column" is not the whole story.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes excellent sense to me!
packages/two_dimensional_scrollables/lib/src/table_view/table.dart
Outdated
Show resolved
Hide resolved
ChildVicinity vicinity, { | ||
bool allowMerged = true, | ||
}) { | ||
return super.getChildFor(vicinity) ?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. That makes sense. Thanks for the explanation!
// vicinity. | ||
assert(_mergedVicinities.keys.contains(vicinity)); | ||
final TableVicinity mergedVicinity = _mergedVicinities[vicinity]!; | ||
return getChildFor(mergedVicinity)!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my own sanity, should this call specify mapMergedVicinityToCanonicalChild: false
to make it super clear, that we do not expect this call to recurse? It is a bug if this call to getChildFor would call _getMergedChildFor again, right? I think specifying this expectation here clearly would make this code a little easier to understand and follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow I totally missed that recursion. Ha! Gotcha, nice catch. 🙃
flutter/packages@5b48c44...d37fb0a 2024-02-02 [email protected] Add a link the different possible Android virtual device configs (flutter/packages#6033) 2024-02-01 [email protected] Update the emulator versions and expose cipd. (flutter/packages#6025) 2024-02-01 [email protected] [tool] Add details to missing gradle coverage error (flutter/packages#6029) 2024-02-01 [email protected] [file_selector] Fix comment typo (flutter/packages#6027) 2024-02-01 [email protected] [camerax] Change `buildPreview` to return `Texture` versus `FutureBuilder` (flutter/packages#6021) 2024-02-01 [email protected] Manual roll Flutter from c65ab4d to e02e207 (38 revisions) (flutter/packages#6028) 2024-02-01 [email protected] Manual roll Flutter from 75a2e5b to c65ab4d (22 revisions) (flutter/packages#6026) 2024-02-01 [email protected] Roll Flutter from ace9181 to 75a2e5b (16 revisions) (flutter/packages#6017) 2024-02-01 [email protected] [webview_flutter] Support for handling basic authentication requests (flutter/packages#5727) 2024-01-31 [email protected] [tool] Extend `flutter test` workaround to other desktops (flutter/packages#6024) 2024-01-31 [email protected] [two_dimensional_scrollables] Merged cells for TableView (flutter/packages#5917) 2024-01-31 [email protected] [rfw] Restore RFW to 100% coverage after `ButtonBar` update (flutter/packages#6020) 2024-01-31 [email protected] [in_app_purchase] Convert storefront(), transactions(), canMakePayment(), and addPayment() to pigeon (flutter/packages#5910) 2024-01-31 [email protected] [in_app_purchase] Add play country code api (flutter/packages#5941) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@Piinks It seems that the package wasn't uploaded on pub.dev after this PR, is there a reason for this ? |
_Description of what this PR is changing or adding, and why:_ Design doc for flutter/packages#5917 _Issues fixed by this PR (if any):_ Related to flutter/flutter#131224 - [x] This PR doesn’t contain automatically generated corrections (Grammarly or similar). - [x] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style) — for example, it doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person). - [x] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer.
_Description of what this PR is changing or adding, and why:_ Design doc for flutter/packages#5917 _Issues fixed by this PR (if any):_ Related to flutter/flutter#131224 ## Presubmit checklist - [x] This PR doesn’t contain automatically generated corrections (Grammarly or similar). - [x] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style) — for example, it doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person). - [x] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer.
Fixes flutter/flutter#131224 �� [Design Doc](https://docs.google.com/document/d/1UekXjG_VKmWYbsxDEzMqTb7F-6oUr05v998n5IqtVWs/edit?usp=sharing) �� This adds support for merged cells in TableView. This contains a breaking change that will require all children of the TableView to be a TableViewCell. ![Screenshot 2024-01-25 at 4 38 49�PM](https://github.com/flutter/packages/assets/16964204/02f4c158-23e9-401e-ac84-b6303d999095)
Fixes flutter/flutter#131224
➡️ Design Doc ⬅️
This adds support for merged cells in TableView.
This contains a breaking change that will require all children of the TableView to be a TableViewCell.
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.